package javaBase.nowcoder.HJ94_A_记票统计;

import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = "";
        Integer n = Integer.parseInt(br.readLine());
        String peoples[] = br.readLine().split(" ");
        Integer vot_n = Integer.parseInt(br.readLine());
        String vot[] = br.readLine().split(" ");
        int valid = 0;
        for (int i = 0; i < peoples.length; i++) {
            int count = 0;
            for (int j = 0; j < vot.length; j++) {
                if (peoples[i].equals(vot[j])) {
                    count++;
                    valid++;
                }
            }
            System.out.println(peoples[i] + " : " + count);
        }
        System.out.println("Invalid : " + (vot_n - valid));
    }
}
